	function calculateTime(objStart, objSlut, objTid, field)
	{
		var wrong = '';

		wrong = validateTime(objStart, true, false, '');
		wrong = wrong + validateTime(objSlut, true, false, '');
		wrong = wrong + validateTime(objTid, true, false, '');
		if (wrong == '')
		{
			var strTimeIn = document.bodyFormB.StartTid.value;
			var strTimeOut = document.bodyFormB.SlutTid.value;
			var strTimeResult = document.bodyFormB.Tid.value;
			var objTimeIn = new Date();
			var objTimeOut = new Date();
			var objTimeResult = new Date();

			intTimeInHours = strTimeIn.match(/\b\d{1,2}/);
			intTimeInMinutes = strTimeIn.match(/\d{2}$/);
			intTimeOutHours = strTimeOut.match(/\b\d{1,2}/);
			intTimeOutMinutes = strTimeOut.match(/\d{2}$/);
			intTimeResultHours = strTimeResult.match(/\b\d{1,2}/);
			intTimeResultMinutes = strTimeResult.match(/\d{2}$/);
			intTimeResult = intTimeResultHours * 3600000 + intTimeResultMinutes * 60000
			objTimeIn.setHours(intTimeInHours)
			objTimeIn.setMinutes(intTimeInMinutes)
			objTimeIn.setSeconds(0)
			objTimeOut.setHours(intTimeOutHours)
			objTimeOut.setMinutes(intTimeOutMinutes)
			objTimeOut.setSeconds(0)
			
			if (field == 1 || field == 2) 
				{
					if (objStart.value != '' && objSlut.value != '')
						{
						objTimeResult.setTime(objTimeOut.getHours()*3600*1000 + objTimeOut.getMinutes()*60*1000 - (objTimeIn.getHours()*3600*1000 + objTimeIn.getMinutes()*60*1000));
						var strMinutes = createMinuteStr(objTimeResult);
						objTid.value = objTimeResult.getUTCHours() + ":" + strMinutes;
						}
				}
			else
				{
					if (objStart.value != '' && objSlut.value != '' && objTid.value != '')
					{
						objSlut.value = ''
						objTimeOut.setTime(objTimeIn.getTime() + intTimeResult);
						var strMinutes = createMinuteStr(objTimeOut)
						objSlut.value = objTimeOut.getHours() + ":" +  strMinutes;
					}
					else if (objStart.value != '' && objTid.value != '')
					{
						objTimeOut.setTime(objTimeIn.getTime() +  + intTimeResult);
						var strMinutes = createMinuteStr(objTimeOut)
						objSlut.value = objTimeOut.getHours() + ":" +  strMinutes;
					}
					else if (objSlut.value != '' && objTid.value != '')
					{
						objTimeIn.setTime(objTimeOut.getTime() - intTimeResult);
						var strMinutes = createMinuteStr(objTimeIn);
						objStart.value = objTimeIn.getHours() + ":" +  strMinutes;
					}
				}
		}

	}
